import * as types from '../types'

import { Map } from 'immutable'



const reducer = (state = Map({
    count: 100
}), action) => {
    switch (action.type) {
        case types.ADD:

            // return { ...state, count: state.count + 1 }
            return state.set('count', state.get('count') + 1)

        case types.REDUCE:

            // return { ...state, count: state.count - action.payload }
            return state.set('count', state.get('count') - action.payload)
        default:
            return state
    }
}


export default reducer